﻿<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../helpproject.xsl" ?>
<topic template="Default" lasteditedby="Geert" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../helpproject.xsd">
  <title translate="true">DelayBindingUpdate</title>
  <keywords>
    <keyword translate="true">Behaviors</keyword>
    <keyword translate="true">Binding</keyword>
    <keyword translate="true">MVVM</keyword>
  </keywords>
  <body>
    <header>
      <para styleclass="Heading1"><text styleclass="Heading1" translate="true">DelayBindingUpdate</text></para>
    </header>
    <para styleclass="Normal"><text styleclass="Normal" translate="true">Sometimes, a binding update should be delayed for performance reasons. This is possible using the </text><link displaytype="text" defaultstyle="true" type="topiclink" href="T_Catel_Windows_Interactivity_DelayBindingUpdate" styleclass="Normal" style="font-style:normal;" translate="true">DelayBindingUpdate</link><text styleclass="Normal" style="font-style:normal;" translate="true"> behavior. This behavior modifies the binding mode to explicit and internally watches for property changes. If the bound dependency property changes, the behavior will wait for the time to pass and then update. If the value changes again within the timeframe, the timer is reset (so you won&apos;t get &quot;double&quot; updates).</text></para>
    <list id="1" type="ol" listtype="decimal" formatstring="&#37;&#48;&#58;&#115;&#46;" format-charset="DEFAULT_CHARSET" levelreset="true" legalstyle="false" startfrom="1" styleclass="Normal" style="font-family:Arial; font-size:10pt; color:#000000;">
      <li styleclass="Normal"><text styleclass="Normal" translate="true">Add the following XML namespaces:</text></li>
    </list>
    <para styleclass="Code Example"><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">xmlns:i=&quot;clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity&quot;</text><br/><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">xmlns:catel=&quot;http://catel.codeplex.com&quot;</text></para>
    <list id="1" type="ol" listtype="decimal" formatstring="&#37;&#48;&#58;&#115;&#46;" format-charset="DEFAULT_CHARSET" levelreset="true" legalstyle="false" startfrom="1" styleclass="Normal" style="font-family:Arial; font-size:10pt; color:#000000;">
      <li styleclass="Normal"><text styleclass="Normal" translate="true">Use the following definition. This example will delay the update of the </text><text styleclass="Normal" style="font-style:italic;" translate="true">SelectedItem</text><text styleclass="Normal" style="font-style:normal;" translate="true"> binding with 100 milliseconds</text><text styleclass="Normal" translate="true">:</text></li>
    </list>
    <para styleclass="Code Example"><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">&lt;ListBox</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">&#32;</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">x:Name=</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">&quot;listBox&quot; </text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">ItemsSource=</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">&quot;{Binding PersonCollection}&quot; </text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">SelectedItem=</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">&quot;{Binding SelectedPerson}&quot;</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">&gt;</text><br/><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true"> &#160; &#160;</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">&lt;</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#0000ff;" translate="true">i</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">:Interaction.Behaviors&gt;</text><br/><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true"> &#160; &#160; &#160; &#160;</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">&lt;catel:DelayBindingUpdate</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">&#32;</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">Property=</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">&quot;SelectedItem&quot; </text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">UpdateDelay=</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">&quot;100&quot; </text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">/&gt;</text><br/><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true"> &#160; &#160;</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">&lt;</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#0000ff;" translate="true">/i</text><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">:Interaction.Behaviors&gt;</text><br/><text styleclass="Code Example" style="font-weight:bold; font-style:normal; color:#000080;" translate="true">&lt;/ListBox&gt;</text></para>
  </body>
</topic>
